<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Menu_Search</title>
<style type="text/css">
p{
	font-family: Arial;
	font-size: small;
	font-weight: normal;
	clear: left;
}
label,input {
	display: block;
	width: 250px;
	float: left;
	margin-bottom: 10px;
}

label {
	text-align: right;
	width: 90px;
	padding-right: 10px;
}
.enviar
{
	width: 70px;
}

</style>
</head>
<body>
<?php
	if (!isset($_GET['s'])) $procura = "3.1.1";
	else $procura = $_GET['s'];
	$xml = new DOMDOcument("1.0","utf-8");
	$dir = ".";
	$arq = $dir . "/secoes.xml";
	$xml->load($arq);
	$teste = $xml->getelementsbytagname("sections");
	function search($no,$lvl,$x,$termos,$ind)
	{
		if ($no->hasChildNodes())
		{
			if ($no->hasAttributes())
			{
				if (!empty($no->attributes->getNamedItem("name")->nodeValue))
				{
					$n = $termos[0];
					for ($j = 1; $j < $ind; $j++)
					{
						if ($j < sizeof($termos)) $n = $n . ".".@$termos[$j];
					}
					echo " &gt; <a href=\"?s=$n\">".$no->attributes->getNamedItem("name")->nodeValue."</a>";
				}
			}
			$y=1;
			foreach($no->childNodes as $t)
			{
				if ( @$termos[$ind] == ($y/2) )
					search($t,$lvl+1,$y,$termos,($ind+1));
				$y++;
			}
		}
		else
		{
			if ($no->hasAttributes())
			{
				if (!empty($no->attributes->getNamedItem("name")->nodeValue))
				{
					if (!empty($no->attributes->getNamedItem("file")->nodeValue))
						echo " &gt; <a href=\"".$no->attributes->getNamedItem("file")->nodeValue."\">".$no->attributes->getNamedItem("name")->nodeValue."</a>";
				}
			}
		}
	}
	$termos = explode(".",$procura);
	echo "Ana-Web";
	search($teste->item(0),0,1,$termos,0);
?>
</body>
</html>